<script type="text/javascript" src="/js/my97datepicker/wdatepicker.js"></script> 
<div class="center">
	<div class="home">
    	<div class="home_left">
        	<?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
        </div>
        <div class="home_right">
			<div class="replacerechargetop">
            	<i>银行汇款</i>
                <div class="replacerechargetname">
                	<h1>银行汇款</h1>
                    <p>如果您通过银行转账给悠奇,请您填写汇款信息,以便悠奇核实。</p>
                </div>
            </div>
			<div class="replacerechargetab">
            	<ul>
                	<li class="tabon"><a class="tab1" href="/member/transfer"><i></i>银行汇款信息填写</a></li>
                        <li><a class="tab1" href="/member/westernunion"><i></i>西联汇款信息填写</a></li>
                </ul>
            </div>
            <form action="/member/transferprocess" method="post" id="form1" enctype="multipart/form-data">
            <div class="apply">
            	<div class="applyts">
                	<i></i>请转账后，第一时间填写汇款信息，以便悠奇尽早核实！
                </div>
                <div class="applytable">
                	<table>
                        <tr>
                            <td class="z">汇款方账号：</td>
                            <td>
                            	<div class="input">
                                    <input class="required" type="text" name="remittanceParty" id="remittanceParty" placeholder="请输入汇款方账号"/>
                                    <span id="remittancePartyMessage" style="display: none;"><font color="red">汇款方账号不能为空</font></span>
                                </div>
                            </td>
                        </tr>
                    	<tr>
                            <td class="z">汇款方姓名：</td>
                            <td>
                            	<div class="input">
                                        <input class="required" type="text" name="remittanceName" id="remittanceName" placeholder="请输入汇款方姓名"/>
                                        <span id="remittanceNameMessage" style="display: none;"><font color="red">汇款方姓名不能为空</font></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">交易流水号：</td>
                            <td>
                            	<div class="input">
                                        <input class="required" type="text" name="dealNo" id="dealNo" placeholder="请输入交易流水号"/>
                                        <span id="dealNoMessage1" style="display: none;"><font color="red">交易流水号不能为空</font></span>
                                        <span id="dealNoMessage2" style="display: none;"><font color="red">该交易流水号已存在</font></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">收款银行：</td>
                            <td>
                            	<div class="input jine">                                    
                                    <input class="required" type="text" name="bank" id="bank"/>
                                    <span id="bankMessage" style="display: none;"><font color="red">收款银行不能为空</font></span>
                                </div>                               
                            </td>
                        </tr>
                        <tr>
                            <td class="z">汇款时间：</td>
                            <td>
                            	<div class="input jine" id="stime">
                                    <input name="stime" class="required number" max="3000" type="text" id="stimeval" readonly/>
                                    <span id="stimevalMessage" style="display: none;"><font color="red">汇款时间不能为空</font></span>
                                </div>
                            </td>
                        </tr>
                    	<tr>
                            <td class="z">汇款金额：</td>
                            <td>
                            	<div class="input jine">
                                    <input name="money" id="money" class="texting required number" max="2000" type="text" />
                                    <span><select id="moneyunit" name="moneyunit" style="padding: 6px 5px;font-size: 14px;">
                                            <?php foreach ($this->unitAll as $key => $unitVal) { ?>
                                            <option value="<?php echo $key;?>"><?php echo $unitVal;?></option>
                                            <?php } ?>
                                        </select></span>
                                    <span id="moneyMessage" style="display: none;"><font color="red">汇款金额不能为空</font></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z"></td>
                            <td>
                            	<div class="input jine">
                                    <span>如没有您汇款的金额单位，请您进行汇率换算后再填写金额，点击<a href="/tool/rate" target="_blank" class="indexa">汇率换算</a></span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="z">汇款凭证：</td>
                            <td>
                                    <input type="file" name="file" id="file"/>
                                    <span id="remittanceMessage" style="display: none;"><font color="red">汇款凭证不能为空</font></span>
                            </td>
                        </tr>
                    </table>
                    <div class="payjiner">
                        <input type="hidden" name="userId" value="<?php echo $this->user->Id; ?>" id="userId" />
                        <p><label id="chargeMsg"><span>汇款凭证是指：转账详情的截图</span></p>
                    </div>
                    <div class="submit">
                        <?php if($this->type == "success"){ ?>
                            <font size='4' color='green'>您的汇款信息提交成功，悠奇很快为您处理！</font>
                        <?php }else{ ?>    
                            <a class="next" href="javascript:send();"><span>提交汇款信息</span></a>
                        <?php } ?>
                    </div>
                </div>
            </div>
            </form>
        </div>    
    </div>
</div>

<script type="text/javascript">
$('.input label').click(function(){    
    $(this).parent().find(':input').focus().click();
    $(this).val("");
});
$('.input input').keyup(function(){
    if($(this).val()===''){
        $(this).prev().show();
    }else{
        $(this).prev().hide();
    }
});
$("#stimeval").click(function(){
    $(this).attr("class","timeselect t_on");
    WdatePicker({el:'stimeval',dateFmt:'yyyy年M月d日',vel:'stime',onpicked:function(){
            //$("#stime").attr("class","timeselect");
    }});
});
function checkForm(){
    if($('#remittanceParty').val().trim() === ""){
        $('#remittancePartyMessage').show();
        return false;
    }else{
        $('#remittancePartyMessage').hide();
    }
    if($('#remittanceName').val().trim() === ""){
        $('#remittanceNameMessage').show();
        return false;
    }else{
        $('#remittanceNameMessage').hide();
    }
    if($('#dealNo').val().trim() === ""){
        $('#dealNoMessage1').show();
        return false;
    }else{
        $('#dealNoMessage1').hide();
    }
    if($('#bank').val().trim() === ""){
        $('#bankMessage').show();        
        return false;
    }else{
        $('#bankMessage').hide();
    }
    if($('#stimeval').val().trim() === ""){
        $('#stimevalMessage').show();
        return false;
    }else{
        $('#stimevalMessage').hide();
    }
    if(isNaN($('#money').val()) || $('#money').val().trim() === ""){
        $('#moneyMessage').show();
        return false;
    }else{
        $('#moneyMessage').hide();
    }
    if($('#file').val().trim() === ""){
        $('#remittanceMessage').show();
        return false;
    }else{
        $('#remittanceMessage').hide();
    }
    if(!$("#dealNoMessage2").is(":hidden")){
        return false;
    }
    return true;
}
$("#dealNo").change(function(){
    var dealNo = $(this).val();
    if($('#dealNo').val().trim() === ""){
        $('#dealNoMessage1').show();
        return false;
    }
    $('#dealNoMessage1').hide();
    $.post(
        '/member/judgedealno',
        {'dealNo':dealNo},
        function (data){
            if(data === 1){
                $('#dealNoMessage2').show();
                return false;
            }else{
                $('#dealNoMessage1').hide();
                $('#dealNoMessage2').hide();
            }
        }
    );
});
function send(){    
    if(checkForm()){
        $('#stimeval').val($('#stime').val());
        $('.submit').html("<font size='4' color='red'>正在提交信息……</font>");
        $('#form1').submit();
        /*var remittanceParty = $('#remittanceParty').val();
        var remittanceName = $('#remittanceName').val();
        var bank = $('#bank').val();
        var stime = $('#stime').val();
        var money = $('#money').val();
        var file = $('#file').val();
        var userId = $('#userId').val();
        $.post(
            '/member/transferprocess',
            {'remittanceParty':remittanceParty,'remittanceName':remittanceName,'bank':bank,'stime':stime,'money':money,'file':file,'userId':userId},
            function (data){
                if(data === 1){
                    $('.submit').html("<font size='4' color='green'>您的汇款信息已经成功提交！</font>");
                }else{
                    $('.submit').html("<font size='4' color='red'>很抱歉，汇款信息提交失败！</font>");
                }
            }
        );*/
    }    
}
</script>